package movie;
/**
 * 2024/5/12
 */
public class MovieOperator {
   private Movie[] movies;
   public MovieOperator(Movie[] movies){
      this.movies=movies;
   }

   /*1.根据系统全部电影信息 movies=[m1,m2,m3...]*/
   public void printAllMovies(){
      System.out.println("-----该系统全部电影如下------");
      for (int i = 0; i < movies.length; i++) {
         Movie m = movies[i];
         System.out.println("编号"+m.getId());
         System.out.println("名称"+m.getName());
         System.out.println("价格"+m.getPrice());
         System.out.println("---------------------");
      }
   }


     /*2.根据电影的编号查询出该电影的详细信息并展示*/
   public void MovieById(int id){
      for (int i = 0; i < movies.length; i++) {
         Movie m = movies[i];
         if(m.getId()==id){
            System.out.println("电影详情如下：");
            System.out.println("编号"+m.getId());
            System.out.println("名称"+m.getName());
            System.out.println("价格"+m.getPrice());
            System.out.println("得分"+m.getScore());
            System.out.println("导演"+m.getDirector());
            System.out.println("主演"+m.getActor());
            System.out.println("其他信息"+m.getInfo());
            return;//找到了电影信息，没必要执行了
         }
      }
      System.out.println("没有该电影信息");
   }

}